草庐IT

sqlite - Symfony2 : Unit testing with sqlite

全部标签

php - 使用 Silex 和 Symfony 3 配置 LDAP 身份验证

我正在尝试使用Symfony(3.0.1)提供的LDAP组件在我的Silex(1.3.5)应用程序中配置LDAP身份验证。这是我当前的配置:$app['ldap']=function(){returnnewSymfony\Component\Ldap\LdapClient('ldap.example.com');};$app->register(newSecurityServiceProvider(),['security.providers'=>['users'=>['ldap'=>['service'=>'ldap','base_dn'=>'dc=example,dc=com','

php - Symfony2 响应内容必须是字符串或对象实现 __toString(), "boolean"given

我正在尝试渲染一个模态窗口动态,问题是当返回我的响应Json时,我得到下一个错误:TheResponsecontentmustbeastringorobjectimplementing__toString(),"boolean"given.这是我的Controller:useSymfony\Component\HttpFoundation\Response;useSymfony\Component\HttpFoundation\JsonResponse;//SomeCode...publicfunctiondetallesAction($id){$em=$this->getDoctri

php - Symfony2 子表单事件传播

我有两个实体。实体A是实体B的父实体。我正在为包含实体B作为子实体的实体A创建REST。classEntityA{private$name;private$type;private$bs;}classEntityB{private$entityA;private$color;}我基本上做一个post/put类似的东西:{"name":"anamehere","type":"atypehere","bs":[{"color":"blue"}]}对于重要的部分,实体A的形式看起来像这样:/***@paramFormBuilderInterface$builder*@paramarray$o

php - Symfony/Doctrine - createQueryBuilder orderBy

我有一个“团队”实体,其属性为“预算”。我只想打印团队属性,我希望预算最高的团队出现在第一位、第二位、第三位...(DESC)。但是使用这段代码,它不起作用,我不明白为什么。indexAction(Controller)$em=$this->getDoctrine()->getManager();$teams=$em->getRepository('FootballBundle:Team')->getAllTeamsSortedByDescBudget();return$this->render('FootballBundle:Default:index.html.twig',arra

javascript - symfony2动态表单修改ajax jquery无效的CSRF token

假设我有产品并且产品可以是promo。单击促销复选框时,我希望显示promoPrice字段。这是我的AbstractType的示例//...//$builder->add(..);$builder->add('promoProduct','checkbox',['required'=>false,]);$builder->add('promoPrice','hidden')//$builder->add(..);$formModifier=function(FormInterface$form,$promoProduct=null){if($promoProduct){$form->a

php - 如何在现有的 Symfony2 应用程序中实现 Sylius OrderBundle

我需要在我的symfony2应用程序中实现syliusOrderBundle,我已经从他们的官方网站上一遍又一遍地阅读文档http://docs.sylius.org/en/latest/bundles/SyliusOrderBundle/installation.html我最终安装并启用了以下bundlenewSylius\Bundle\ResourceBundle\SyliusResourceBundle(),newSylius\Bundle\MoneyBundle\SyliusMoneyBundle(),newSylius\Bundle\OrderBundle\SyliusOrd

php - 如何使用我的自定义 Symfony 3.0 Library/Bundle/HowIsCalled

通过查看这些文档:http://symfony.com/doc/current/cookbook/bundles/configuration.htmlhttp://symfony.com/doc/current/components/dependency_injection/introduction.html#basic-usage我制作了这个库:0?$value:0;}protectedfunctionsetThumbWidth($value){$thumb_max_width=$value>0?$value:0;}/***FunctionthatLoadstheconfigurat

php - Symfony/Doctrine 中的动态数据库和模式创建

我想在静态数据库中存储数据库连接。根据需要,我想创建一个新数据库,将凭据存储在我的静态数据库中,然后根据现有实体在新数据库中创建模式。我知道如何使用symfony的命令行工具来做到这一点。我的目标是让它在服务中工作。我查看了Doctrine文档并尝试让一些东西起作用:$conn=$this->getDoctrine()->getConnection()->getSchemaManager()->createDatabase($dbname);$isDevMode=true;$config=Setup::createAnnotationMetadataConfiguration(arra

php - Symfony - 在表单的 EventSubscriber 中注入(inject)实体管理器

这是我第一次使用表单的EventListener,所以我正在努力研究如何在其中注入(inject)EntityManager。我有一个名为UserType的formType,在这个类中我有一个EventSubscriberAddDepartmentDegreeCourseFieldSubscriber需要访问EntityManagerclassUserTypeextendsAbstractType{/***@paramFormBuilderInterface$builder*@paramarray$options*/publicfunctionbuildForm(FormBuilder

php - Symfony 未定义的命名空间

我到处都看到命名空间错误,我不确定为什么。例如我有:使用Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;并且Configuration为红色,错误为:UndefinednamespaceConfigurationless...(Ctrl+F1)Referencednamespaceisnotfound.我该如何解决这个问题? 最佳答案 既然您说“Configuration是红色的”,我认为您遇到的问题与IDE有关如果您使用的是PHPStorm,那么只要您的设置是标准的,就